import java.io.Serializable;

/**
 * 创建学生信息管理系统，
 * 学生信息分别为学号、年龄、姓名
 */

public class StudentInformationManagementSystem implements Serializable {

    //定义学生信息的变量
    private int id;
    private int age;
    private String name;

    public StudentInformationManagementSystem() {
    }

    public StudentInformationManagementSystem(int id, int age, String name) throws IdException, AgeException {
        setId(id);
        setAge(age);
        setName(name);
    }

    public int getId() {
        return id;
    }

    public void setId(int id) throws IdException {

        if (id > 0) {
            this.id = id;
        } else {
            throw new IdException("学号并不合理！！！");

        }
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) throws AgeException {
        if (age>0 && age < 150) {
            this.age = age;
        } else {
            throw new AgeException("年龄不合理！！！");
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
